/**
 * Created by LeungZ on 2016/8/19.
 */
class Replicas {
    constructor($modalInstance, service, serviceSrv, ctgNotification) {
        'ngInject';
        this._modalInstance = $modalInstance;
        this._serviceSrv = serviceSrv;
        this._notification = ctgNotification;
        this.name = service.dpName;
        this.created = service.newRs.pods.current;
        this.desired = service.newRs.pods.desired;
        this.code = service.k8sCode;
        this.namesp = service.namespace;
    }

    cancel() {
        this._modalInstance.dismiss('cancel');
    }

    save(){
        this.loading = true;
        this._serviceSrv.updateReplicasDp(this).then(()=>{
            this._modalInstance.close();
            this._notification.success('手动伸缩成功.');
        }).catch(()=>{
            this._notification.error('手动伸缩失败.');
        }).finally(()=>{
            this.loading = false;
        });

    }
}


export default Replicas